<style>
#status{
	color: red;
	display: inline;
}
</style>
<script type="text/javascript">
	$(document).ready(function(){
		var validator = $("#tbDataForm").validate({

		//ignore: ".ignore",
		rules: {			
			name:{
				required:true
			},			
			email: {
				required: true,
				email: true
			}
		},
		messages: {
		name:"<? if($lang=='th')echo "กรุณากรอกชื่อ - นามสกุล";else echo "please enter name";?>",
		email: {
				required: "<? if($lang=='th')echo "กรุณากรอก อีเมล์";else echo "please enter email";?>",
				minlength: "<? if($lang=='th')echo "กรุณากรอก อีเมล์ ให้ถูกต้อง";else echo "Please enter a valid email address";?>"
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else

				error.appendTo( element.parent().next() );
		},

                submitHandler: function() {
				  form.submit;
		},

		// specifying a submitHandler prevents the default submit, good for the demo
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			//label.html("").addClass("checked");  
			                          
		}
	}
});
		
</script>
<h2>ข้อมูลผู้ใช้งาน [เพิ่ม / แก้ไข]</h2>
<div></div>
<form id="tbDataForm" enctype="multipart/form-data" method="post" action="admin_user/save">
<table class="tbDataForm" width="100%">
  <tr>
  <td colspan="2" style="padding:10px;" class="ui-state-error"><strong>ข้อมูลผู้ใช้งาน
  (เพิ่ม/แก้ไข)</strong></td>
  </tr>
		<tr>
			<td><strong>กลุ่มผู้ใช้งาน</strong></td>
			<td>
				<? echo form_dropdown('usertype',get_option('id','name','usertype'),@$rs['usertype'],'','-- เลือกกลุ่มผู้ใช้งาน --');?>
			</td>
		</tr>
		<tr>
			<td><strong>ภาควิชา</strong></td>
			<td>
				<? echo form_dropdown('sectionid',get_option('id','title','tbsection'),@$rs['sectionid'],'','-- เลือกภาควิชา --');?>
			</td>
		</tr>
		<tr>
			<td><strong>ชื่อ - นามสกุล</strong></td>
			<!-- <th align="left"><? if($lang=='th')echo LBL_REGISTER_MEMBER_NAME_TH;else echo LBL_REGISTER_MEMBER_NAME_EN;?></th> -->
			<td>
			  <input type="hidden" name="id" value="<?=@$rs['id'];?>" />
            	<input type="hidden" name="registerdate" value="<?=@$rs['registerdate'];?>" />            	
				<span><input name="name" type="text" value="<?=@$rs['name'];?>" size="50" class="" /></span>
				<div id="status"></div>
				<span class="txtOrange">*</span>
			</td>
		</tr>
		<tr>
			<td><strong>เลขบัตรประชาชน</strong></td>
			<td>
				 <input name="id_card" type="text" id="id_card" value="<?=@$rs['id_card'];?>" size="35" />
			</td>
		</tr>		
		<tr>
			<td><strong>เบอร์ติดต่อ</strong></td>
			<td>
				<input name="tel" type="text" id="tel" value="<?=@$rs['tel'];?>" size="20"/>
			</td>
		</tr>
		<tr>
		  <td><strong><? if($lang=='th')echo LBL_REGISTER_MEMBER_EMAIL_TH;else echo LBL_REGISTER_MEMBER_EMAIL_EN;?></strong></td>
	    <td>
	    	<span><input name="email" type="text" id="email" value="<?=@$rs['email'];?>" size="50" /></span> 
	    	<div id="status"></div>
			<span class="txtOrange">*</span>
	    	</td>
	  </tr>
	  <tr>
	  	<td><strong>Username</strong></td>
	  	<td>
	  		<input name="username" type="text" id="username" value="<?=@$rs['username'];?>" size="50"/>
		</td>
	  </tr>
	  <? if(@$rs['id']>0): ?>
	  <tr>
	  	<td height="35"> <strong>รหัสผ่านปัจจุบัน</strong></td>
		<td><?=@$rs['password'];?></td>
	  </tr>
	  <? endif;?>
		<tr>
		  <td><strong><? if($lang=='th')echo LBL_REGISTER_MEMBER_PASSWORD_TH;else echo LBL_REGISTER_MEMBER_PASSWORD_EN;?></strong></td>
		  <td><input type="password" name="password" value="" /><input type="hidden" name="current_password" value="<?=@$rs['password'];?>" />&nbsp; <?if(@$rs['id']<1){?><span class="txtOrange">*</span><? } ?></td>
	  </tr>
		<tr>
		 <td><strong><? if($lang=='th')echo LBL_REGISTER_MEMBER_CONFIRM_PASSWORD_TH;else echo LBL_REGISTER_MEMBER_CONFIRM_PASSWORD_EN;?></strong></td>
		  <td><input type="password" name="confirm_password" value="">&nbsp; <?if(@$rs['id']<1){?><span class="txtOrange">*</span><? } ?></td>
	  </tr>                        
		<tr>			
			<td colspan="2" align="center">
				<input type="submit" value="   บันทึกรายการ   " style="padding:3px;"  class="ui-state-error ui-corner-all"> <input type="button" value="   ย้อนกลับ   " style="padding:3px;" onclick="history.back();" class="ui-state-active ui-corner-all btn"> 
			</td>
		</tr>
	</table>
</form>